package hg.demo.ehcache.controller;

import hg.demo.ehcache.bean.UserBean;
import hg.demo.ehcache.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/insert")
    public String insert(UserBean userBean) {
        userService.insert(userBean);
        return "新增成功";
    }

    @RequestMapping(value = "/query")
    public Object insert(String name) {
        return userService.query(name);
    }
}
